TuPerfil.net is a monorepo Next.js 14 application with two distinct surfaces — a public news portal and a protected admin dashboard — backed by a single Supabase project.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/santiagodc8/tu_perfil.net/llms.txt
Use this file to discover all available pages before exploring further.
Two main surfaces
Public site
Server-rendered with Next.js App Router. Readers browse articles, categories, and search results without logging in. All data is fetched from Supabase on the server, so pages are SEO-friendly and fast.
Admin panel
Protected by Next.js middleware. Every request to
/admin/* (except /admin/login) is intercepted and checked for an active Supabase session before the page renders.Technology layers
| Layer | Technology | Role |
|---|---|---|
| Framework | Next.js 14 (App Router, TypeScript) | Routing, SSR, API routes |
| Database | Supabase PostgreSQL | All persistent data |
| Auth | Supabase Auth | Session management, JWT |
| Storage | Supabase Storage | Article images (article-images bucket) |
| Styling | Tailwind CSS + Typography plugin | UI and article body rendering |
| Rich text | TipTap | Article content editor |
| Resend | Newsletter delivery | |
| Dates | date-fns (Spanish locale) | Date formatting across the UI |
| Deployment | Vercel | Hosting and CI/CD |
Folder structure
How server components fetch data
The public site uses React Server Components by default. Each page imports the server-side Supabase client fromsrc/lib/supabase/server.ts and queries the database directly — no intermediate API call is needed for read operations:
src/lib/supabase/server.ts
src/lib/supabase/client.ts instead:
src/lib/supabase/client.ts
How middleware protects /admin routes
The filesrc/middleware.ts applies to every request matching /admin/:path*:
src/middleware.ts
updateSession (in src/lib/supabase/middleware.ts) creates a short-lived Supabase client, refreshes the session cookie if needed, and applies two redirect rules:
- Unauthenticated user →
/admin/*: redirect to/admin/login. - Authenticated user →
/admin/login: redirect to/admin(already logged in).
API route handlers
Write operations from the public site (and some admin actions) go through Next.js API routes undersrc/app/api/. These routes use the server-side Supabase client or the admin client (which uses the SUPABASE_SERVICE_ROLE_KEY and bypasses RLS):
src/lib/supabase/admin.ts
| Route prefix | Purpose |
|---|---|
/api/views | Increment article view counts and record page-view events |
/api/contact | Accept and store contact form submissions |
/api/newsletter | Subscribe or unsubscribe email addresses |
/api/comments | Submit reader comments (pending moderation) |
/api/ads | Record ad impression and click events |
Row Level Security
Every table in the database has RLS enabled. Supabase enforces these policies at the PostgreSQL level — even if application code has a bug, unauthenticated users cannot read unpublished articles, access contact messages, or modify any data they are not allowed to touch. The general pattern across all tables:| Action | Who can perform it |
|---|---|
| Read published content | Anonymous and authenticated users |
| Read unpublished / sensitive data | Authenticated users only |
| Insert, update, delete | Authenticated users only |
